package com.xique.park.api;

import com.xique.common.core.constant.ServiceNameConstants;
import com.xique.common.core.domain.R;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.park.api.factory.RemoteParkCarServiceFallbackFactory;
import com.xique.park.api.request.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 车辆管理服务
 *
 * @author WLD
 */
@FeignClient(contextId = "RemoteParkCarService",
        value = ServiceNameConstants.PARK_BIZ_SERVICE,
        fallbackFactory = RemoteParkCarServiceFallbackFactory.class)
public interface RemoteParkCarService {

    /**
     * 删除超过了有效期的黑名单车辆
     *
     * @return /
     */
    @DeleteMapping("/web/car/removeBlackExpire")
    R<String> removeBlackExpire();

    /**
     * 下发到了启用日期的黑名单车辆
     *
     * @return /
     */
    @PostMapping("/web/car/downEnableBlackCar")
    R<String> downEnableBlackCar();


    @PostMapping("/web/car/simple/list")
    AjaxResult simpleParkCarList(@Validated @RequestBody RemoteParkCarRequest request);

    /**
     * 获取车辆列表
     *
     * @param request
     * @return com.xique.common.core.domain.R<?>
     * @author shd
     * @date 2022/6/17 14:04
     */
    @PostMapping("/api/car/list")
    AjaxResult getCarList(@Valid @RequestBody RemoteGetCarListRequest request);

    /**
     * 获取车辆管理类型
     *
     * @param parkId
     * @return com.xique.common.core.web.domain.AjaxResult
     * @author shd
     * @date 2022/6/20 10:56
     */
    @GetMapping("/api/car/mngType/list")
    AjaxResult getMngTypeList(@RequestParam("parkId") Long parkId);

    /**
     * 拉黑
     *
     * @param request
     * @return com.xique.common.core.web.domain.AjaxResult
     * @author shd
     * @date 2022/6/20 13:25
     */
    @PostMapping("/api/car/addBlack")
    AjaxResult addBlack(@Valid @RequestBody RemoteBlackCarRequest request);

    /**
     * 移除黑名单（直接删除车辆信息）
     *
     * @param carId
     * @return com.xique.common.core.web.domain.AjaxResult
     * @author shd
     * @date 2022/6/20 13:55
     */
    @DeleteMapping("/api/car/removeBlack")
    AjaxResult removeBlack(@RequestParam("carId") Long carId, @RequestParam("parkId") Long parkId);

    /**
     * 删除车辆
     * @param carId  车辆id
     * @param parkId 车场id
     * @return
     */
    @DeleteMapping("/api/car/remove")
    AjaxResult removeCar(@RequestParam("carId") Long carId, @RequestParam("parkId") Long parkId);

    /**
     * 修改车辆
     * @param request
     * @return
     */
    @PutMapping("/api/car/updateCar")
     AjaxResult updateCar(@Validated @RequestBody RemoteParkCarEditRequest request);

    /**
     * 新增车辆
     * @param
     * @return
     */
    @PostMapping("/api/car/addCar")
     AjaxResult addCar(@Validated @RequestBody RemoteParkCarAddRequest request);
    }
